const querystring = require('querystring')

const post = (req, res, next) => {

  let chunks = []
  // 接受事件
  req.on('data', chunk => chunks.push(chunk))
  // 接受事件完毕
  req.on('end', () => {
    req.body = querystring.parse(Buffer.concat(chunks).toString())  // aa=aaa&bb=bbbb
    next()
  })
}
module.exports = post
